package com.qf.exception;

public class UserDemo {
    public static void main(String[] args) {

        User user = new User();
        try {
            user.setAge(-10);
        } catch (AgeException e) {
            Integer code = e.getCode();
            String errorMsg = e.getErrorMsg();
            System.out.println(code);
            System.out.println(errorMsg);
            // 封装一个出错的json，返回给前端

        }
        System.out.println(user);
    }
}
